import 'package:flutter/material.dart';
import 'package:get/get.dart';

class BasicCard extends StatelessWidget {
  final String title;
  final List<String> values;
  final List<String> labels;
  final Color? color;
  final IconData icon;

  const BasicCard({
    super.key,
    required this.title,
    required this.values,
    required this.labels,
    this.color,
    required this.icon,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.all(16),
      decoration: BoxDecoration(
        color: Colors.white,
        border: Border.all(color: Colors.white),
        borderRadius: BorderRadius.circular(10),
        boxShadow: [
          BoxShadow(
            color: Color.fromRGBO(149, 157, 165, 0.2),
            // rgba(149, 157, 165, 0.2)
            offset: Offset(0, 8),
            // (0px, 8px)
            blurRadius: 24,
            // 24px
            spreadRadius: 0, // 0px
          ),
        ],
      ),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Row(
            children: [
              Icon(icon),
              SizedBox(width: 5),
              Text(title, style: TextStyle(fontSize: 18)),
            ],
          ),
          SizedBox(height: 10), // 增加上下间隙
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: List<Widget>.generate(
              values.length,
              (int index) => _buildStatisticItem(values[index], labels[index]),
            ),
          ),
        ],
      ),
    );
  }

  Widget _buildStatisticItem(String value, String label) {
    return Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        Text(value, style: TextStyle(fontSize: 16)),
        SizedBox(height: 10),
        Text(label, style: TextStyle(fontSize: 16)),
      ],
    );
  }
}
